package com.vogue.supplymall.order.domain.service.impl;

import com.vogue.ssm.database.dao.BaseDao;
import com.vogue.supplymall.common.domain.dto.EditCartInfo;
import com.vogue.supplymall.common.domain.dto.OrderDetailInfo;
import com.vogue.supplymall.common.domain.dto.OrderInfo;
import com.vogue.supplymall.order.domain.dao.OrderItemProductDao;
import com.vogue.supplymall.order.domain.model.OrderItemProduct;
import com.vogue.supplymall.order.domain.service.OrderItemProductService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * The type Order item product service.
 *
 * @aouthor: zhangliang
 * @date: Create in 2018-01-10
 */
@Service("orderItemProductService")
public class OrderItemProductServiceImpl extends BaseServiceImpl<OrderItemProduct, Long> implements OrderItemProductService {
    @Resource
    private OrderItemProductDao orderItemProductDao;

    /**
     * Instantiates a new Order item product service.
     *
     * @param baseDao the base dao
     */
    public OrderItemProductServiceImpl(BaseDao<OrderItemProduct, Long> baseDao) {
        super(baseDao);
    }

    @Override
    public List<Map<String, Object>> findCart(EditCartInfo editCartInfo) {
        return orderItemProductDao.findCart(editCartInfo);
    }

    @Override
    public Long findCartCount(EditCartInfo editCartInfo) {
        return orderItemProductDao.findCartCount(editCartInfo);
    }

    /**
     * Find order list.
     *
     * @param orderInfo the order info
     * @return the list
     */
    @Override
    public List<Map<String, Object>> findOrder(OrderInfo orderInfo) {
        return orderItemProductDao.findOrder(orderInfo);
    }

    @Override
    public OrderItemProduct addOrderItemProduct(OrderItemProduct orderItemProduct) {
        return orderItemProductDao.save(orderItemProduct);
    }

    @Override
    public OrderItemProduct getOrderItemProductBySql(Long orderid, Long productid, Long attrplanid, Long storageid) {
        return orderItemProductDao.getOrderItemProductBySql(orderid, productid, attrplanid, storageid);
    }

    @Override
    public List<Map<String, Object>> findOrderProduct(OrderDetailInfo orderDetailInfo) {
        return orderItemProductDao.findOrderProduct(orderDetailInfo);
    }

    @Override
    public Long getItemAndStorage(EditCartInfo editCartInfo) {
        return orderItemProductDao.getItemAndStorage(editCartInfo);
    }


}
